<!-- <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    这里是子页面
    <button id="login">登录</button>
</body>
<script>
    window.onload = function(){
        var login  = document.querySelector('#login');
        console.log()
        login.onclick = function(){
            localStorage.setItem("lastname", "Gates");
            parent.window.parentMethod();
        }
    }
    
</script>
</html> -->

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <button id="paybuT">支付</button>
<script>
    window.onload = function(){
        var paybuT = document.getElementById('paybuT');
        paybuT.onclick = function(){
            var obj = {
              token:'65455656416541646464',
              type:'login'
            }
            top.postMessage(obj, '*');
        }
     
    }


</script>
</body>
</html>
